﻿; (function (window, undefined, $) {
    var submiting = false;
    $('#frmEdit').validator({
        fields: {
            //'#MemberId': 'required',
            //'#MessTitle': 'required',
            //'#MessContent': 'required',
            //'#CreateTime': 'required',
            //'#ReplyContent': 'required',
            //'#ReplyUser': 'required'
        },
        valid: function (form) {
            if (submiting) {
                return;
            }
            submiting = true;
            FormSubmit(form, function (res) {
        
                if (res.Status > 0) {
                    alert('操作成功！');
                    window.parent.location.href = "/admin/login";
                }
                else {
                    layer.msg('操作失败！' + res.Message, 2, 8);
                }
                submiting = false;
            })
        }
    });

    
    $("#btnSave").click(function (e) {
        //var deptName = $("#DeptID").find("option:selected").text();
        //$("#hideDeptName").val(deptName);
        $("#frmEdit").submit();
    });
    $("#btnClose").click(function () {
        var index = parent.layer.getFrameIndex(window.name);
        parent.layer.close(index);
    });

    function login() {
        window.parent.location.href = "/admin/login";
    }

})(window, undefined, jQuery);